Component({
  properties: {
    layout: {
      type: Object,
      value: {}
    }
  },
  data: {
    containerPaddingTop: 0,
    containerHeight: 0,
  },
  methods: {
    pageBack() {
      wx.navigateBack({
        delta: this.data.layout.backLevel ?? 1,
        fail(res) {
          wx.switchTab({
            url: "/pages/home/index"
          })
        }
      })
    }
  },
  lifetimes: {
    attached() {
      const res = wx.getMenuButtonBoundingClientRect();
      this.setData({
        // paddingTop : top y + half height
        containerPaddingTop: res.top,
        containerHeight: res.height
      })
    }
  }
});
